package com.xlobo.api.charge.testcase;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.xlobo.api.charge.parameter.CalculateDeliveryFeeBean;
import com.xlobo.api.charge.service.CalculateDeliveryFeeCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;

/**
 * 计算做单运费接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_CalculateDeliveryFee {

	private static CalculateDeliveryFeeBean calculateDeliveryFeeBean;
	private static CalculateDeliveryFeeCall calculateDeliveryFeeCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("计算做单运费接口");
	}

	@Before
	public void caseUp() {
		calculateDeliveryFeeBean = new CalculateDeliveryFeeBean();
		calculateDeliveryFeeCall = new CalculateDeliveryFeeCall();

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(calculateDeliveryFeeCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CalculateDeliveryFee_001() {
		Logger.start(true,"获取做单运费成功");
		try {
			calculateDeliveryFeeBean.setLogisticId(1);
			calculateDeliveryFeeBean.setBillType(2);
			calculateDeliveryFeeBean.setChargeLevel(1);
			calculateDeliveryFeeBean.setWeight(new BigDecimal(0.1));
			calculateDeliveryFeeCall.setData(calculateDeliveryFeeBean);
			calculateDeliveryFeeCall.callService();
			Logger.comment("calculateDeliveryFeeCall send:" + calculateDeliveryFeeCall.getEntityString());
			Logger.comment("calculateDeliveryFeeCall response:" + calculateDeliveryFeeCall.getReturnData());
			Logger.verifyEquals("true", calculateDeliveryFeeCall.getMsg(), "验证卖家ID与传入是否一致");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}